package com.cuijq.ms.template.v5;

/**
 * @author by CuiJQ
 * @Classname Runtime
 * @Description Runtime Description
 * @Date 2021/5/28 20:47
 */
public class Runtime {

  private Runtime() {

  }

  private static Runtime sigRuntime = new Runtime();

  public static Runtime getRuntime() {
    return sigRuntime;
  }

  public void addShutdownHook(Thread hook) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
      sm.checkPermission(new RuntimePermission("shutdownHooks"));
    }
    ApplicationShutdownHooks.add(hook);
  }
}
